//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

#include "_tracTORPhy.h"
#include "_tracTOR.h"
#include "tractorDecider.h"

Define_Module(_tracTORPhy);

AnalogueModel* _tracTORPhy::getAnalogueModelFromName(std::string name, ParameterMap& params) const {

	if (name == "_tracTOR") {
		return initialize_tracTOR(params);
	}
	return PhyLayer::getAnalogueModelFromName(name, params);
}

AnalogueModel* _tracTORPhy::initialize_tracTOR(ParameterMap& params) const {
	double par1 = params["param"].doubleValue();


	return new _tracTOR(par1);
}

Decider* _tracTORPhy::getDeciderFromName(std::string name, ParameterMap& params) {

    ev << "Decider: " << name << endl;

    if(name == "tractorDecider"){

        const char* directoryPath = params["directoryPath"].stringValue();
        const char* fileList = params["fileList"].stringValue();
        const char* idFileList = params["idFileList"].stringValue();
        EV << directoryPath << endl;
        EV << fileList << endl;
        EV << idFileList << endl;
        return new tractorDecider(this, sensitivity, findHost()->getIndex(), coreDebug, directoryPath, fileList, idFileList);
    }
    return PhyLayer::getDeciderFromName(name, params);
}
